home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8670 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: ccshst05.cs.uoguelph.ca!ccshst01!thay
  2. From: thay@uoguelph.ca (Toby K Hay)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help with sin() - big problem
  5. Date: 5 Mar 1996 18:44:27 GMT
  6. Organization: University of Guelph
  7. Message-ID: <4hi22b$r3n@ccshst05.cs.uoguelph.ca>
  8. References: <4hhusi$49i@sunburst.ccs.yorku.ca>
  9. NNTP-Posting-Host: ccshst01.cs.uoguelph.ca
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Naftali Sturm (yu114405@yorku.ca) wrote:
  13. : I am making a math and trigonometry program which, one of its functions
  14. : is to compute the sine of a number.
  15. :  The way I did it was. 
  16. :     result = sin(numb);
  17.  
  18. :  The problem is that when numb is 1.0, the
  19. : program gives me .84147 , and when numb is 45.0 
  20. : the program gives me .85090, and each number is a different result.
  21. :   Why?
  22. Because sin() returns the sine of an angle measured in radians and you 
  23. are giving it angles measured in degrees.  Convert your angles from 
  24. degrees to radians (by multiplying by pi/180) and you'll get the answers 
  25. you expect.  The conversion works because 180 degrees equals pi radians.
  26. Toby Hay    thay@uoguelph.ca
  27.